package tech.yangzhijie.basic.knowledge.other;

public class AtomicTest02 {

    public static void main(String[] args) {
        AtomicDemo02 atomicDemo02 = new AtomicDemo02();

        for (int i = 0;i < 200;i++){
            new Thread(atomicDemo02).start();
        }
    }
}

class AtomicDemo02 implements Runnable{

    private int num = 1;

    public int getNum() {
        return num++;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.print(getNum() + ",");
    }
}